Tata Infotech Previous Years Solved Sample Placement Papers
-
What does the join() method do when called on a thread object?
A: Terminates the thread
B: Pauses the thread
C: Forces the current executing thread to wait until the thread it's called on completes
D: Checks the status of a thread
Ans: C -
Which method can be used to momentarily pause the execution of the current thread?
A: sleep()
B: wait()
C: pause()
D: stop()
Ans: A -
Which interface provides an alternative to extending the Thread class?
A: Runnable
B: Callable
C: Executor
D: Parallel
Ans: A -
What is a daemon thread in Java?
A: A thread that monitors and logs other threads
B: A thread that runs continuously in the background
C: A thread that manages memory usage
D: A thread that is part of the Java virtual machine
Ans: B -
Which interface represents a collection of objects in which duplicate values can be stored?
A: List
B: Set
C: Map
D: ListMap
Ans: A -
What will be the initial capacity of an ArrayList if it is created with the no-argument constructor?
A: 0
B: 5
C: 10
D: 16
Ans: C -
What does a Set guarantee?
A: Order
B: No duplicates
C: Both
D: None of the above
Ans: B -
Which List implementation is synchronized?
A: ArrayList
B: Vector
C: LinkedList
D: None of the above
Ans: B -
What does the transient keyword indicate in a Java class?
A: The variable can change over time
B: The variable cannot be serialized
C: The variable is thread-safe
D: The variable is volatile
Ans: B -
Which of these is a checked exception?
A: NullPointerException
B: ArithmeticException
C: IOException
D: IndexOutOfBoundsException
Ans: C -
Which interface represents a key-value pair mechanism?
A: List
B: Set
C: Queue
D: Map
Ans: D